package net.pugsplace.gpremacy.state;

import net.pugsplace.gpremacy.rules.Country;
import net.pugsplace.gpremacy.rules.CountryType;
import net.pugsplace.gpremacy.rules.UnitType;

public class AbstractCountry implements Country {
	private static final long serialVersionUID = -6205956704307927541L;
	private UnitType[] availableUnits;
	private String name;
	private ResourceTuple[] stockpile;
	private final CountryType countryType;

	public AbstractCountry(CountryType countryType) {
		this.countryType = countryType;
		this.name = countryType.getName();
		this.availableUnits = countryType.getDefaultAvailableUnits();
		this.stockpile = new ResourceTuple[0];
	}

	public UnitType[] getAvailableUnits() {
		return availableUnits;
	}

	public CountryType getCountryType() {
		return countryType;
	}

	public String getName() {
		return name;
	}

	public ResourceTuple[] getResources() {
		return stockpile;
	}

	public void setAvailableUnits(UnitType[] units) {
		assert units != null;
		this.availableUnits = units;
	}

	public void setName(String newName) {
		assert newName != null;
		this.name = newName;
	}

	public void setResources(ResourceTuple[] newResources) {
		assert newResources != null;
		this.stockpile = newResources;
	}

}
